function HandleTableModifyDesign(gui, item, options) {
  this._gui = gui;
  this._item = item;
  this._options = options;

  this._user = (options && options.user) ? options.user : null;
  this._date = (options && options.date) ? options.date : null;
  
  this._createElements();
};

HandleTableModifyDesign.prototype._createElements = function() {
  var tr, td;
  tr = this._gui.main.insertRow(-1);
  td = tr.insertCell(-1);
  td.style.height = '180px'; 
  td.style.textAlign = 'center';
  td.appendChild(DOMUtils.getLoadingImage());
  
  this._loadData();
};

HandleTableModifyDesign.prototype._loadData = function() {
  this._purchaseItems = null;
  this._samples = null;
  this._retrievePurchaseItems();
  this._retrieveSamples();
};

HandleTableModifyDesign.prototype._verifyData = function() {
  if (this._purchaseItems && this._samples) {
    this._updateElements();
  }
};

HandleTableModifyDesign.prototype._retrievePurchaseItems = function() {
  var _self = this;
  /*new RequestUtils()._read('purchaseitem', null, 'd.otherId = \'' + this._item.pi_trackId + '\'', null, null, null, null, function(result, params) { _self._purchaseItems = result.data;
                                                                                                                                                               _self._verifyData.call(_self);
                                                                                                                                                             }, null);
*/

  //var args = '&oid=' + this._item.pi_trackId + '&orderid =' + this._item.orderId;
  var args = '&oid=' + this._item.pi_trackId + '&orid=' + this._item.orderId; 
  new RequestUtils()._mysql('v1purchaseitem_o', args, function(result, params) { _self._purchaseItems = result.data;
                                                                          _self._verifyData.call(_self);
                                                                        }, {php:'customphp/mysqlread.php'});  
};

HandleTableModifyDesign.prototype._retrieveSamples = function() {
  var _self = this;
  /*new RequestUtils()._read('sample', null, '', null, null, null, null, function(result, params) { _self._samples = result.data;
                                                                                                  _self._verifyData.call(_self);
                                                                                                }, null);
*/
  var args = '&c='+' where u.isdisplay = 0 '; 
  new RequestUtils()._mysql('v1sample_s', args, function(result, params) { _self._samples = result.data;
                                                                          _self._verifyData.call(_self);
                                                                        }, {php:'customphp/mysqlread.php'});  
};

HandleTableModifyDesign.prototype._updateElements = function() {
  var tr, td, _self = this;
  DOMUtils.removeTableRows(this._gui.main, 0);
  
  this._item._purchaseItems = this._purchaseItems;

  for (var i = 0, il = this._purchaseItems.length; i < il; i++) {
    var item = this._purchaseItems[i];
    tr = this._gui.main.insertRow(-1);
    td = tr.insertCell(-1);
    td.style.verticalAlign = 'top';
    td.style.padding = '0 0 10px 0';
    var options = MiscUtils.clone(this._options);
    options.samples = this._samples;
    new DialogModifyDesign(td, item, options);
  }
  
};